<%--
  Created by IntelliJ IDEA.
  User: 13415372994
  Date: 2024/1/4
  Time: 11:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改页面</title>
</head>
<body>
<h1>修改页面</h1>
<form method="post" action="${pageContext.request.contextPath}/modify?id=${car.carId}">
    <table border="1">
        <tr>
            <td>车名：</td>
            <td><input type="text" name="name" value="${car.carName}"></td>
        </tr>

        <tr>
            <td>车价(万)：</td>
            <td><input type="text" name="price" value="${car.carPrice}"></td>
        </tr>

        <tr>
            <td>里程：</td>
            <td><input type="text" name="mileage" value="${car.carMileage}"></td>
        </tr>

        <tr>
            <td>购车时间：</td>
            <td><input type="text" name="buyTime" value="${car.carBuyTime}">yyyy-MM-dd</td>
        </tr>

        <tr>
            <td>车型：</td>
            <td>
                <select name="type">
                    <option value="1" ${car.carType eq '1' ? 'selected' : ''}>轿车</option>
                    <option value="2" ${car.carType eq '2' ? 'selected' : ''}>SUV</option>
                </select>
            </td>
        </tr>

        <tr>
            <td>状态：</td>
            <td>
                <input type="radio" name="status" value="0">已售
                <input type="radio" name="status" value="1">在售
            </td>
        </tr>

        <tr>
            <td>操作：</td>
            <td>
                <input type="submit" value="修改">
                <input type="button" value="返回" onclick="history.back()">
            </td>
        </tr>
    </table>
</form>
</body>
<script>
    if ('${car.carStatus}' == '0'){
        document.getElementsByName("status")[0].checked = true;
    }else {
        document.getElementsByName("status")[1].checked = true;
    }
</script>
</html>
